package com.eleme.address.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.eleme.address.entity.Address;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import java.util.List;

/**
 * 地址表Mapper
 */
@Mapper
@Repository
public interface AddressMapper extends BaseMapper<Address> {
    @Select("select * from deliveryAddress where userId=#{userId} order by daId")
    List<Address> listDeliveryAddressByUserId(String userId);
    @Select("select * from deliveryAddress where daId=#{daId}")
    Address getDeliveryAddressById(Integer daId);
    @Insert("insert into deliveryAddress values(null,#{contactName},#{contactSex},#{contactTel},#{address},#{userId})")
    int saveDeliveryAddress(Address address);
    @Update("update deliveryAddress set contactName=#{contactName},contactSex=#{contactSex},contactTel=#{contactTel},address=#{address} where daId=#{daId}")
    int updateDeliveryAddress(Address address);
    @Delete("delete from deliveryAddress where daId=#{daId}")
    int removeDeliveryAddress(Integer daId);
} 